from functools import wraps
import logging
from psycopg2 import IntegrityError, OperationalError, errorcodes
import random
import threading
import time

import odoo
from odoo.exceptions import UserError, ValidationError, QWebException
from odoo.models import check_method_name
from odoo.tools.translate import translate
from odoo.tools.translate import _

from . import security
from ..tools import traverse_containers, lazy

_logger = logging.getLogger(__name__)

PG_CONCURRENCY_ERRORS_TO_RETRY = (errorcodes.LOCK_NOT_AVAILABLE, errorcodes.SERIALIZATION_FAILURE, errorcodes.DEADLOCK_DETECTED)
MAX_TRIES_ON_CONCURRENCY_FAILURE = 5

def dispatch(method, params):
    pass

def check(f):
    @wraps(f)
    def wrapper(___dbname, *args, **kwargs):
        pass

    return wrapper

def execute_cr(cr, uid, obj, method, *args, **kw):
    pass

def execute_kw(db, uid, obj, method, args, kw=None):
    pass

@check
def execute(db, uid, obj, method, *args, **kw):
    pass